home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Text / print / HPDJ400Src.lha / density.c < prev    next >
C/C++ Source or Header  |  2004-05-23  |  1KB  |  43 lines

  1. /*
  2.  *
  3.  *       Density module for HP_DeskJet_400L
  4.  *
  5.  */
  6.  
  7. #include "global.h"
  8.  
  9. #define DENSITY 15
  10.  
  11.  
  12. void SetDensity(ULONG density_code)
  13. {
  14.         extern struct PrinterData *PD;
  15.         extern struct PrinterExtendedData *PED;
  16.         extern char StartCmd[];
  17.  
  18.         /* SPECIAL_DENSITY     0   1   2    3    4    5    6    7 */
  19.         static int XDPI[8] = {75, 75, 150, 150, 150, 300, 300, 300};
  20.         static char codes[8][3] = {
  21.         {'0','7','5'},{'0','7','5'},{'1','5','0'},{'1','5','0'},
  22.         {'1','5','0'},{'3','0','0'},{'3','0','0'},{'3','0','0'},
  23.         };
  24.  
  25.         PED->ped_MaxColumns =
  26.                 PD->pd_Preferences.PaperSize == W_TRACTOR ? 136 : 80;
  27.  
  28.         density_code /= SPECIAL_DENSITY1;
  29.         PED->ped_MaxXDots = (XDPI[density_code] * PED->ped_MaxColumns) / 10; 
  30.  
  31.         /* David Berezowski - April 22/90 */
  32.         /* default is 10.0, US_LEGAL is 14.0 */
  33.         PED->ped_MaxYDots =
  34.                 PD->pd_Preferences.PaperSize == US_LEGAL ? 14 : 10;
  35.         PED->ped_MaxYDots *= XDPI[density_code];
  36.  
  37.         PED->ped_XDotsInch = PED->ped_YDotsInch = XDPI[density_code];
  38.  
  39.         StartCmd[DENSITY] = codes[density_code][0];
  40.         StartCmd[DENSITY+1] = codes[density_code][1];
  41.         StartCmd[DENSITY+2] = codes[density_code][2];
  42. }
  43.